<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>项目笔记 | ShuangChenYue</title>
    <meta name="generator" content="VuePress 1.9.9">
    <link rel="icon" href="https://cdn.jsdelivr.net/gh/cmty256/imgs-blog@main/logo/白云.38zbldnhh180.jpg">
    <meta name="description" content="满招损，谦受益">
    <meta name="keywords" content="专注于Cpp语言的旅行者">
    
    <link rel="preload" href="/assets/css/0.styles.3fffbd7d.css" as="style"><link rel="preload" href="/assets/js/app.ef25b098.js" as="script"><link rel="preload" href="/assets/js/2.4615a819.js" as="script"><link rel="preload" href="/assets/js/84.4602494c.js" as="script"><link rel="prefetch" href="/assets/js/10.5712a6b9.js"><link rel="prefetch" href="/assets/js/11.1fed716c.js"><link rel="prefetch" href="/assets/js/12.4672093d.js"><link rel="prefetch" href="/assets/js/13.cda96393.js"><link rel="prefetch" href="/assets/js/14.0924c9b3.js"><link rel="prefetch" href="/assets/js/15.443e1f82.js"><link rel="prefetch" href="/assets/js/16.554bf912.js"><link rel="prefetch" href="/assets/js/17.994ca8e7.js"><link rel="prefetch" href="/assets/js/18.4879414d.js"><link rel="prefetch" href="/assets/js/19.f66c5ece.js"><link rel="prefetch" href="/assets/js/20.79449f9c.js"><link rel="prefetch" href="/assets/js/21.0b51ee17.js"><link rel="prefetch" href="/assets/js/22.14f9241e.js"><link rel="prefetch" href="/assets/js/23.fa858e5d.js"><link rel="prefetch" href="/assets/js/24.a420d3d2.js"><link rel="prefetch" href="/assets/js/25.fee08d36.js"><link rel="prefetch" href="/assets/js/26.92805480.js"><link rel="prefetch" href="/assets/js/27.5c60f91f.js"><link rel="prefetch" href="/assets/js/28.2bbf1597.js"><link rel="prefetch" href="/assets/js/29.05fbd423.js"><link rel="prefetch" href="/assets/js/3.7b56aee3.js"><link rel="prefetch" href="/assets/js/30.54f725db.js"><link rel="prefetch" href="/assets/js/31.3e5c530d.js"><link rel="prefetch" href="/assets/js/32.f8ecda14.js"><link rel="prefetch" href="/assets/js/33.3bef3da7.js"><link rel="prefetch" href="/assets/js/34.0e1b1990.js"><link rel="prefetch" href="/assets/js/35.21acae61.js"><link rel="prefetch" href="/assets/js/36.744eb2f7.js"><link rel="prefetch" href="/assets/js/37.077678f2.js"><link rel="prefetch" href="/assets/js/38.d2c19552.js"><link rel="prefetch" href="/assets/js/39.d873f04b.js"><link rel="prefetch" href="/assets/js/4.8844c7c6.js"><link rel="prefetch" href="/assets/js/40.a9c0394e.js"><link rel="prefetch" href="/assets/js/41.bd1b72f7.js"><link rel="prefetch" href="/assets/js/42.8c5ba50f.js"><link rel="prefetch" href="/assets/js/43.aac76280.js"><link rel="prefetch" href="/assets/js/44.2601ff73.js"><link rel="prefetch" href="/assets/js/45.2802dd41.js"><link rel="prefetch" href="/assets/js/46.3a872e80.js"><link rel="prefetch" href="/assets/js/47.fb914cfa.js"><link rel="prefetch" href="/assets/js/48.4ce4214b.js"><link rel="prefetch" href="/assets/js/49.968e0b60.js"><link rel="prefetch" href="/assets/js/5.d85ca603.js"><link rel="prefetch" href="/assets/js/50.4cee1e39.js"><link rel="prefetch" href="/assets/js/51.5cad3040.js"><link rel="prefetch" href="/assets/js/52.1612ad39.js"><link rel="prefetch" href="/assets/js/53.e9cf7aec.js"><link rel="prefetch" href="/assets/js/54.2821cc0e.js"><link rel="prefetch" href="/assets/js/55.6f8ddb85.js"><link rel="prefetch" href="/assets/js/56.58b793ba.js"><link rel="prefetch" href="/assets/js/57.3d08056f.js"><link rel="prefetch" href="/assets/js/58.880ee89f.js"><link rel="prefetch" href="/assets/js/59.987dab20.js"><link rel="prefetch" href="/assets/js/6.b5c87a76.js"><link rel="prefetch" href="/assets/js/60.6089e8d9.js"><link rel="prefetch" href="/assets/js/61.2f20e8a2.js"><link rel="prefetch" href="/assets/js/62.03592460.js"><link rel="prefetch" href="/assets/js/63.77002dd4.js"><link rel="prefetch" href="/assets/js/64.180619d0.js"><link rel="prefetch" href="/assets/js/65.2750f9b6.js"><link rel="prefetch" href="/assets/js/66.c696b1af.js"><link rel="prefetch" href="/assets/js/67.03363cd9.js"><link rel="prefetch" href="/assets/js/68.163161cc.js"><link rel="prefetch" href="/assets/js/69.6d87bcc0.js"><link rel="prefetch" href="/assets/js/7.70b0614b.js"><link rel="prefetch" href="/assets/js/70.53173d63.js"><link rel="prefetch" href="/assets/js/71.5acaf78b.js"><link rel="prefetch" href="/assets/js/72.e5473318.js"><link rel="prefetch" href="/assets/js/73.fca88a39.js"><link rel="prefetch" href="/assets/js/74.d45cfae5.js"><link rel="prefetch" href="/assets/js/75.81660c22.js"><link rel="prefetch" href="/assets/js/76.3e7aeba1.js"><link rel="prefetch" href="/assets/js/77.2e4da6e0.js"><link rel="prefetch" href="/assets/js/78.7f7d7694.js"><link rel="prefetch" href="/assets/js/79.f60ae352.js"><link rel="prefetch" href="/assets/js/8.ecc019cf.js"><link rel="prefetch" href="/assets/js/80.3a10fa1d.js"><link rel="prefetch" href="/assets/js/81.72805d9a.js"><link rel="prefetch" href="/assets/js/82.c1d3f9b6.js"><link rel="prefetch" href="/assets/js/83.9014695a.js"><link rel="prefetch" href="/assets/js/85.f2189c96.js"><link rel="prefetch" href="/assets/js/86.b6a21db1.js"><link rel="prefetch" href="/assets/js/87.9be7c553.js"><link rel="prefetch" href="/assets/js/88.562483e1.js"><link rel="prefetch" href="/assets/js/89.336befe6.js"><link rel="prefetch" href="/assets/js/9.4b46b767.js"><link rel="prefetch" href="/assets/js/90.e916d603.js"><link rel="prefetch" href="/assets/js/91.873db624.js"><link rel="prefetch" href="/assets/js/92.9072026b.js"><link rel="prefetch" href="/assets/js/93.0baf9593.js"><link rel="prefetch" href="/assets/js/94.8655b40d.js"><link rel="prefetch" href="/assets/js/95.bd6a4d6c.js"><link rel="prefetch" href="/assets/js/96.943e9bb3.js"><link rel="prefetch" href="/assets/js/97.ea0c9e4a.js">
    <link rel="stylesheet" href="/assets/css/0.styles.3fffbd7d.css">
  </head>
  <body class="theme-mode-light">
    <div id="app" data-server-rendered="true"><div class="theme-container sidebar-open have-rightmenu"><header class="navbar blur"><div title="目录" class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" class="home-link router-link-active"><img src="https://cdn.jsdelivr.net/gh/cmty256/imgs-blog@main/logo/白云.38zbldnhh180.jpg" alt="ShuangChenYue" class="logo"> <span class="site-name can-hide">ShuangChenYue</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/" class="nav-link">首页</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="CPP语言" class="dropdown-title"><!----> <span class="title" style="display:;">CPP语言</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/c5bdd8/" class="nav-link">Cpp之旅</a></li><li class="dropdown-item"><!----> <a href="/pages/279e62/" class="nav-link">Cpp专栏</a></li><li class="dropdown-item"><!----> <a href="/pages/801755/" class="nav-link">Effective_CPP</a></li><li class="dropdown-item"><!----> <a href="/pages/6b2468/" class="nav-link">muduo网络库</a></li><li class="dropdown-item"><!----> <a href="/pages/5f8c9f/" class="nav-link">Unix环境高级编程</a></li><li class="dropdown-item"><!----> <a href="/pages/3f1d21/" class="nav-link">Cpp提高编程</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="计算机基础" class="dropdown-title"><!----> <span class="title" style="display:;">计算机基础</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/7b1cb2/" class="nav-link">计算机网络</a></li><li class="dropdown-item"><!----> <a href="/pages/6048a8/" class="nav-link">操作系统</a></li><li class="dropdown-item"><!----> <a href="/pages/3b34ba/" class="nav-link">数据结构</a></li><li class="dropdown-item"><!----> <a href="/pages/412fe7/" class="nav-link">Linux</a></li><li class="dropdown-item"><!----> <a href="/pages/2dcfa1/" class="nav-link">算法</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="数据库" class="dropdown-title"><!----> <span class="title" style="display:;">数据库</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/efa3f2/" class="nav-link">基础篇</a></li><li class="dropdown-item"><!----> <a href="/pages/ccc445/" class="nav-link">MySql</a></li><li class="dropdown-item"><!----> <a href="/pages/54616e/" class="nav-link">Redis</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="系统设计" class="dropdown-title"><!----> <span class="title" style="display:;">系统设计</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/793d0a/" class="nav-link">权限校验</a></li><li class="dropdown-item"><!----> <a href="/pages/73ddd7/" class="nav-link">设计模式</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="开发日常" class="dropdown-title"><!----> <span class="title" style="display:;">开发日常</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/71f6ae/" class="nav-link">Git知识总结</a></li><li class="dropdown-item"><!----> <a href="/pages/777b8a/" class="nav-link">nvm使用小结</a></li><li class="dropdown-item"><!----> <a href="/pages/ee770e/" class="nav-link">虚拟机固定 IP 地址</a></li><li class="dropdown-item"><!----> <a href="/pages/e472d1/" class="nav-link">随笔（持续更新）</a></li><li class="dropdown-item"><!----> <a href="/pages/411aa4/" class="nav-link">VScode 插件 CodeGeeX 使用教程</a></li><li class="dropdown-item"><!----> <a href="/pages/0d525d/" class="nav-link">KylinV10 将项目上传至 Github教程</a></li><li class="dropdown-item"><!----> <a href="/pages/ef40f0/" class="nav-link">KylinV10 安装 MySQL 教程（可防踩雷）</a></li><li class="dropdown-item"><!----> <a href="/pages/f8640c/" class="nav-link">个人博客代码推送教程</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="前端学习" class="dropdown-title"><!----> <span class="title" style="display:;">前端学习</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/99897f/" class="nav-link">HTML与CSS</a></li><li class="dropdown-item"><!----> <a href="/pages/51542d/" class="nav-link">JS学习</a></li><li class="dropdown-item"><!----> <a href="/pages/803f9d/" class="nav-link">Vue3入门</a></li><li class="dropdown-item"><!----> <a href="/pages/ca4cfb/" class="nav-link">Vue3进阶</a></li><li class="dropdown-item"><!----> <a href="/pages/50e8d3/" class="nav-link">黑马Vue3</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="项目笔记" class="dropdown-title"><!----> <span class="title" style="display:;">项目笔记</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/08dfe9/" class="nav-link">ip_file_hook</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="面经" class="dropdown-title"><!----> <span class="title" style="display:;">面经</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/d69946/" class="nav-link">虎牙C++技术面经</a></li><li class="dropdown-item"><!----> <a href="/pages/29251d/" class="nav-link">金山一面复习</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="其它" class="dropdown-title"><!----> <span class="title" style="display:;">其它</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/fa256e/" class="nav-link">博客搭建</a></li><li class="dropdown-item"><!----> <a href="/pages/335531/" class="nav-link">网站收藏箱</a></li></ul></div></div> <!----></nav></div></header> <div class="sidebar-mask"></div> <div class="sidebar-hover-trigger"></div> <aside class="sidebar" style="display:none;"><!----> <nav class="nav-links"><div class="nav-item"><a href="/" class="nav-link">首页</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="CPP语言" class="dropdown-title"><!----> <span class="title" style="display:;">CPP语言</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/c5bdd8/" class="nav-link">Cpp之旅</a></li><li class="dropdown-item"><!----> <a href="/pages/279e62/" class="nav-link">Cpp专栏</a></li><li class="dropdown-item"><!----> <a href="/pages/801755/" class="nav-link">Effective_CPP</a></li><li class="dropdown-item"><!----> <a href="/pages/6b2468/" class="nav-link">muduo网络库</a></li><li class="dropdown-item"><!----> <a href="/pages/5f8c9f/" class="nav-link">Unix环境高级编程</a></li><li class="dropdown-item"><!----> <a href="/pages/3f1d21/" class="nav-link">Cpp提高编程</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="计算机基础" class="dropdown-title"><!----> <span class="title" style="display:;">计算机基础</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/7b1cb2/" class="nav-link">计算机网络</a></li><li class="dropdown-item"><!----> <a href="/pages/6048a8/" class="nav-link">操作系统</a></li><li class="dropdown-item"><!----> <a href="/pages/3b34ba/" class="nav-link">数据结构</a></li><li class="dropdown-item"><!----> <a href="/pages/412fe7/" class="nav-link">Linux</a></li><li class="dropdown-item"><!----> <a href="/pages/2dcfa1/" class="nav-link">算法</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="数据库" class="dropdown-title"><!----> <span class="title" style="display:;">数据库</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/efa3f2/" class="nav-link">基础篇</a></li><li class="dropdown-item"><!----> <a href="/pages/ccc445/" class="nav-link">MySql</a></li><li class="dropdown-item"><!----> <a href="/pages/54616e/" class="nav-link">Redis</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="系统设计" class="dropdown-title"><!----> <span class="title" style="display:;">系统设计</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/793d0a/" class="nav-link">权限校验</a></li><li class="dropdown-item"><!----> <a href="/pages/73ddd7/" class="nav-link">设计模式</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="开发日常" class="dropdown-title"><!----> <span class="title" style="display:;">开发日常</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/71f6ae/" class="nav-link">Git知识总结</a></li><li class="dropdown-item"><!----> <a href="/pages/777b8a/" class="nav-link">nvm使用小结</a></li><li class="dropdown-item"><!----> <a href="/pages/ee770e/" class="nav-link">虚拟机固定 IP 地址</a></li><li class="dropdown-item"><!----> <a href="/pages/e472d1/" class="nav-link">随笔（持续更新）</a></li><li class="dropdown-item"><!----> <a href="/pages/411aa4/" class="nav-link">VScode 插件 CodeGeeX 使用教程</a></li><li class="dropdown-item"><!----> <a href="/pages/0d525d/" class="nav-link">KylinV10 将项目上传至 Github教程</a></li><li class="dropdown-item"><!----> <a href="/pages/ef40f0/" class="nav-link">KylinV10 安装 MySQL 教程（可防踩雷）</a></li><li class="dropdown-item"><!----> <a href="/pages/f8640c/" class="nav-link">个人博客代码推送教程</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="前端学习" class="dropdown-title"><!----> <span class="title" style="display:;">前端学习</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/99897f/" class="nav-link">HTML与CSS</a></li><li class="dropdown-item"><!----> <a href="/pages/51542d/" class="nav-link">JS学习</a></li><li class="dropdown-item"><!----> <a href="/pages/803f9d/" class="nav-link">Vue3入门</a></li><li class="dropdown-item"><!----> <a href="/pages/ca4cfb/" class="nav-link">Vue3进阶</a></li><li class="dropdown-item"><!----> <a href="/pages/50e8d3/" class="nav-link">黑马Vue3</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="项目笔记" class="dropdown-title"><!----> <span class="title" style="display:;">项目笔记</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/08dfe9/" class="nav-link">ip_file_hook</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="面经" class="dropdown-title"><!----> <span class="title" style="display:;">面经</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/d69946/" class="nav-link">虎牙C++技术面经</a></li><li class="dropdown-item"><!----> <a href="/pages/29251d/" class="nav-link">金山一面复习</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="其它" class="dropdown-title"><!----> <span class="title" style="display:;">其它</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/fa256e/" class="nav-link">博客搭建</a></li><li class="dropdown-item"><!----> <a href="/pages/335531/" class="nav-link">网站收藏箱</a></li></ul></div></div> <!----></nav>  <ul class="sidebar-links"><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading open"><span>存储介质消除工具</span> <span class="arrow down"></span></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/pages/67c5c8/" aria-current="page" class="active sidebar-link">项目笔记</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level2"><a href="/pages/67c5c8/#_1、项目运行" class="sidebar-link">1、项目运行</a></li><li class="sidebar-sub-header level2"><a href="/pages/67c5c8/#_2、运行效果图" class="sidebar-link">2、运行效果图</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level3"><a href="/pages/67c5c8/#未插入u盘时" class="sidebar-link">未插入U盘时</a></li><li class="sidebar-sub-header level3"><a href="/pages/67c5c8/#插入u盘时" class="sidebar-link">插入U盘时</a></li><li class="sidebar-sub-header level3"><a href="/pages/67c5c8/#文件粉碎页面" class="sidebar-link">文件粉碎页面</a></li><li class="sidebar-sub-header level3"><a href="/pages/67c5c8/#痕迹清除页面" class="sidebar-link">痕迹清除页面</a></li><li class="sidebar-sub-header level3"><a href="/pages/67c5c8/#磁盘清理页面" class="sidebar-link">磁盘清理页面</a></li><li class="sidebar-sub-header level3"><a href="/pages/67c5c8/#点击数据清除功能" class="sidebar-link">点击数据清除功能</a></li><li class="sidebar-sub-header level3"><a href="/pages/67c5c8/#点击打开文件功能" class="sidebar-link">点击打开文件功能</a></li><li class="sidebar-sub-header level3"><a href="/pages/67c5c8/#点击关于我们" class="sidebar-link">点击关于我们</a></li></ul></li><li class="sidebar-sub-header level2"><a href="/pages/67c5c8/#_3、每个文件实现的功能" class="sidebar-link">3、每个文件实现的功能</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level3"><a href="/pages/67c5c8/#files-wipe-h和files-wipe-cpp" class="sidebar-link">fileswipe.h和fileswipe.cpp</a></li><li class="sidebar-sub-header level3"><a href="/pages/67c5c8/#info-dev-h和info-dev-cpp" class="sidebar-link">infodev.h和infodev.cpp</a></li><li class="sidebar-sub-header level3"><a href="/pages/67c5c8/#scan-files-h和scan-files-cpp" class="sidebar-link">scanfiles.h和scanfiles.cpp</a></li><li class="sidebar-sub-header level3"><a href="/pages/67c5c8/#web-connect-h和web-connect-cpp" class="sidebar-link">webconnect.h和webconnect.cpp</a></li><li class="sidebar-sub-header level3"><a href="/pages/67c5c8/#work-main-h和work-main-cpp" class="sidebar-link">workmain.h和workmain.cpp</a></li></ul></li></ul></li></ul></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>ip_file_hook</span> <span class="arrow right"></span></p> <!----></section></li></ul> </aside> <div><main class="page"><div class="theme-vdoing-wrapper "><div class="articleInfo-wrap" data-v-06225672><div class="articleInfo" data-v-06225672><ul class="breadcrumbs" data-v-06225672><li data-v-06225672><a href="/" title="首页" class="iconfont icon-home router-link-active" data-v-06225672></a></li> <li data-v-06225672><span data-v-06225672>项目笔记</span></li><li data-v-06225672><span data-v-06225672>存储介质消除工具</span></li></ul> <div class="info" data-v-06225672><div title="作者" class="author iconfont icon-touxiang" data-v-06225672><a href="javascript:;" data-v-06225672>霜晨月</a></div> <div title="创建时间" class="date iconfont icon-riqi" data-v-06225672><a href="javascript:;" data-v-06225672>2023-11-24</a></div> <!----></div></div></div> <!----> <div class="content-wrapper"><div class="right-menu-wrapper"><div class="right-menu-margin"><div class="right-menu-title">目录</div> <div class="right-menu-content"></div></div></div> <h1><img src="">项目笔记<!----></h1> <!----> <div class="theme-vdoing-content content__default"><h1 id="存储介质信息消除工具项目"><a href="#存储介质信息消除工具项目" class="header-anchor">#</a> 存储介质信息消除工具项目</h1> <h2 id="_1、项目运行"><a href="#_1、项目运行" class="header-anchor">#</a> 1、项目运行</h2> <p>在release文件夹下有三个环境版本，这里选择X86_64的环境</p> <p><img src="https://cdn.jsdelivr.net/gh/xiaose-code/Pictures@main/img/1699952498192.webp" alt="1699952498192"></p> <p>先运行服务端（要先把测试用的U盘先插入连接到虚拟机）</p> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">sudo</span> ./server_wipe <span class="token parameter variable">-f</span> <span class="token punctuation">..</span>/etc/conf/configure.txt
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p>运行客户端</p> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code>./client_wipe <span class="token parameter variable">-f</span> <span class="token punctuation">..</span>/etc/conf/configure.txt
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p>功能一：显示系统信息</p> <p>功能二：文件粉碎</p> <p>功能三：痕迹清楚</p> <p>功能四：磁盘清理</p> <h2 id="_2、运行效果图"><a href="#_2、运行效果图" class="header-anchor">#</a> 2、运行效果图</h2> <h3 id="未插入u盘时"><a href="#未插入u盘时" class="header-anchor">#</a> 未插入U盘时</h3> <p><img src="https://cdn.jsdelivr.net/gh/xiaose-code/Pictures@main/img/1700012394343.webp" alt="1700012394343"></p> <h3 id="插入u盘时"><a href="#插入u盘时" class="header-anchor">#</a> 插入U盘时</h3> <p><img src="https://cdn.jsdelivr.net/gh/xiaose-code/Pictures@main/img/1700029803063.webp" alt="1700029803063"></p> <blockquote><p>默认第一个页面是显示系统信息页面</p></blockquote> <p>主界面的实现在<code>wid_main.h</code>和<code>wid_main.cpp</code>文件中的 <code>wid_main</code> 的初始化信号槽部分。</p> <p>它包括以下几个部分：</p> <ol><li><p><strong>按钮颜色和状态控制：</strong> 使用 <code>keep_butt_col</code> 函数保持按钮选中颜色，<code>into_sys_op</code> 函数在点击左侧按钮时显示对应的操作界面，<code>get_show_wid</code> 函数获取当前显示的操作界面。</p></li> <li><p><strong>左侧按钮事件连接：</strong> 为左侧按钮连接对应事件主动发送的信号，以及左侧按钮点击事件的连接。</p></li> <li><p><strong>操作按钮信号：</strong> 连接清理按钮、打开按钮、关于我们按钮和退出程序按钮的点击事件。</p></li> <li><p><strong>最小化和关闭按钮：</strong> 连接最小化按钮和关闭按钮的点击事件。</p></li></ol> <p>这段代码主要是建立了各个按钮之间的关联关系，以及按钮和对应操作界面之间的连接。在用户点击按钮时，会触发相应的操作，例如打开文件选择对话框、清理文件等。</p> <blockquote><p>页面系统信息内容主要在<code>wid_sys_info.h</code>和<code>wid_sys_info.cpp</code>文件中</p></blockquote> <p><img src="https://cdn.jsdelivr.net/gh/xiaose-code/Pictures@main/img/1700191336476.webp" alt="1700191336476"></p> <h3 id="文件粉碎页面"><a href="#文件粉碎页面" class="header-anchor">#</a> 文件粉碎页面</h3> <p><img src="https://cdn.jsdelivr.net/gh/xiaose-code/Pictures@main/img/1700187559704.webp" alt="1700187559704"></p> <h3 id="痕迹清除页面"><a href="#痕迹清除页面" class="header-anchor">#</a> 痕迹清除页面</h3> <p><img src="https://cdn.jsdelivr.net/gh/xiaose-code/Pictures@main/img/1700187729701.webp" alt="1700187729701"></p> <h3 id="磁盘清理页面"><a href="#磁盘清理页面" class="header-anchor">#</a> 磁盘清理页面</h3> <p><img src="https://cdn.jsdelivr.net/gh/xiaose-code/Pictures@main/img/1700187850134.webp" alt="1700187850134"></p> <h3 id="点击数据清除功能"><a href="#点击数据清除功能" class="header-anchor">#</a> 点击数据清除功能</h3> <p>清除之前：</p> <p><img src="https://cdn.jsdelivr.net/gh/xiaose-code/Pictures@main/img/1700187965126.webp" alt="1700187965126"></p> <p>清除之后：</p> <p><img src="https://cdn.jsdelivr.net/gh/xiaose-code/Pictures@main/img/1700188348876.webp" alt="1700188348876"></p> <h3 id="点击打开文件功能"><a href="#点击打开文件功能" class="header-anchor">#</a> 点击打开文件功能</h3> <p><img src="https://cdn.jsdelivr.net/gh/xiaose-code/Pictures@main/img/1700188056128.webp" alt="1700188056128"></p> <h3 id="点击关于我们"><a href="#点击关于我们" class="header-anchor">#</a> 点击关于我们</h3> <p><img src="https://cdn.jsdelivr.net/gh/xiaose-code/Pictures@main/img/1700188092864.webp" alt="1700188092864"></p> <p>实际就是显示一张图片，省时间</p> <h2 id="_3、每个文件实现的功能"><a href="#_3、每个文件实现的功能" class="header-anchor">#</a> 3、每个文件实现的功能</h2> <h3 id="files-wipe-h和files-wipe-cpp"><a href="#files-wipe-h和files-wipe-cpp" class="header-anchor">#</a> files_wipe.h和files_wipe.cpp</h3> <p>用于安全删除文件和目录内容，确保无法被恢复。以下是每个函数的功能总结：</p> <ol><li><p><strong>构造函数和析构函数：</strong></p> <div class="language-CPP line-numbers-mode"><pre class="language-cpp"><code><span class="token function">files_wipe</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token operator">~</span><span class="token function">files_wipe</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><ul><li>构造函数分配一个用于文件覆盖的缓冲区，并初始化随机数生成器。</li> <li>析构函数释放分配的内存。</li></ul></li> <li><p><strong>wipe_file 函数：</strong></p> <div class="language-CPP line-numbers-mode"><pre class="language-cpp"><code><span class="token comment">//粉碎文件操作</span>
<span class="token comment">//粉碎文件时参数:文件名,粉碎次数</span>
<span class="token comment">//粉碎磁盘时参数:文件名,粉碎次数,false(非分件不删除),进度条回调,粉碎完成回调</span>
<span class="token keyword">void</span> <span class="token function">wipe_file</span><span class="token punctuation">(</span>string filename<span class="token punctuation">,</span><span class="token keyword">int</span> num<span class="token punctuation">,</span><span class="token keyword">bool</span> is_file <span class="token operator">=</span> <span class="token boolean">true</span><span class="token punctuation">,</span>                   
               function<span class="token operator">&lt;</span><span class="token keyword">void</span><span class="token punctuation">(</span>string file<span class="token punctuation">,</span><span class="token keyword">int</span> current<span class="token punctuation">,</span><span class="token keyword">int</span> num<span class="token punctuation">)</span><span class="token operator">&gt;</span> fn_prog <span class="token operator">=</span> <span class="token keyword">nullptr</span><span class="token punctuation">,</span><span class="token comment">// 进度条回调函数</span>
               function<span class="token operator">&lt;</span><span class="token keyword">void</span><span class="token punctuation">(</span>string file<span class="token punctuation">,</span><span class="token keyword">bool</span> finish<span class="token punctuation">,</span>__off_t off<span class="token punctuation">)</span><span class="token operator">&gt;</span> fn_finish <span class="token operator">=</span> <span class="token keyword">nullptr</span><span class="token punctuation">,</span><span class="token comment">// 粉碎完成回调函数</span>
               __off_t off_continue <span class="token operator">=</span> <span class="token operator">-</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token comment">// 中断时的偏移量</span>
               <span class="token keyword">int</span> num_continue <span class="token operator">=</span> <span class="token operator">-</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token comment">// 中断时的粉碎次数</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br></div></div></li> <li><p><strong>wipe_dir 函数：</strong></p> <div class="language-CPP line-numbers-mode"><pre class="language-cpp"><code><span class="token comment">// 粉碎文件夹及其子目录中的文件(回调可监控正在删除的文件)</span>
<span class="token keyword">void</span> <span class="token function">wipe_dir</span><span class="token punctuation">(</span>string path_dir<span class="token punctuation">,</span><span class="token keyword">int</span> num<span class="token punctuation">,</span>
              function<span class="token operator">&lt;</span><span class="token keyword">void</span><span class="token punctuation">(</span>string<span class="token punctuation">)</span><span class="token operator">&gt;</span> fn_name <span class="token operator">=</span> <span class="token keyword">nullptr</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br></div></div><ul><li>参数：
<ul><li><code>path_dir</code>: 待覆盖的目录。</li> <li><code>num</code>: 覆盖的次数。</li> <li><code>fn_name</code>: 每个文件或目录的回调函数。</li></ul></li></ul></li> <li><p><strong>wipe_dir 函数（重载）：</strong></p> <div class="language-CPP line-numbers-mode"><pre class="language-cpp"><code><span class="token comment">// 粉碎一组文件夹及其子目录中的文件(回调可监控正在删除的文件)</span>
<span class="token keyword">void</span> <span class="token function">wipe_dir</span><span class="token punctuation">(</span>vector<span class="token operator">&lt;</span>string<span class="token operator">&gt;</span> vec_name<span class="token punctuation">,</span><span class="token keyword">int</span> num<span class="token punctuation">,</span>
              function<span class="token operator">&lt;</span><span class="token keyword">void</span><span class="token punctuation">(</span>string<span class="token punctuation">)</span><span class="token operator">&gt;</span> fn_name <span class="token operator">=</span> <span class="token keyword">nullptr</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br></div></div><ul><li>参数：
<ul><li><code>vec_name</code>: 待覆盖的目录向量。</li> <li><code>num</code>: 覆盖的次数。</li> <li><code>fn_name</code>: 每个文件或目录的回调函数。</li></ul></li></ul></li> <li><p><strong>get_dir_file 函数：</strong></p> <div class="language-cpp line-numbers-mode"><pre class="language-cpp"><code><span class="token comment">//获取目录下需要删除的所有文件与目录名称</span>
vector<span class="token operator">&lt;</span>string<span class="token operator">&gt;</span> <span class="token function">get_dir_file</span><span class="token punctuation">(</span>string path_dir<span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><ul><li>参数：
<ul><li><code>path_dir</code>: 目录路径。</li></ul></li> <li>返回一个包含文件和子目录路径的字符串向量。</li></ul></li> <li><p><strong>get_err_vec 函数：</strong></p> <div class="language-cpp line-numbers-mode"><pre class="language-cpp"><code><span class="token comment">//获取无法打开的文件</span>
vector<span class="token operator">&lt;</span>string<span class="token operator">&gt;</span> <span class="token function">get_err_vec</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><ul><li>返回最近一次执行 <code>wipe_file</code> 函数时出现的错误文件向量。</li></ul></li> <li><p><strong>set_skip 函数：</strong></p> <div class="language-cpp line-numbers-mode"><pre class="language-cpp"><code><span class="token comment">//跳过并结束粉碎</span>
<span class="token keyword">void</span> <span class="token function">set_skip</span><span class="token punctuation">(</span><span class="token keyword">bool</span> skip<span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><ul><li>设置是否跳过执行。如果设置为跳过，下一次执行 <code>wipe_file</code> 时将退出。</li></ul></li> <li><p><strong>set_flush_zero、set_flush_one、set_flush_letter 函数：</strong></p> <div class="language-cpp line-numbers-mode"><pre class="language-cpp"><code><span class="token comment">//填充随机字节块内容</span>
<span class="token keyword">void</span> <span class="token function">set_flush_zero</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">void</span> <span class="token function">set_flush_one</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">void</span> <span class="token function">set_flush_letter</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><ul><li>分别用于设置缓冲区的内容为全零、全一、随机字母。</li></ul></li> <li><p><strong>is_exist_file 函数：</strong></p> <div class="language-cpp line-numbers-mode"><pre class="language-cpp"><code><span class="token comment">//判断文件是否存在</span>
<span class="token keyword">bool</span> <span class="token function">is_exist_file</span><span class="token punctuation">(</span><span class="token keyword">const</span> string <span class="token operator">&amp;</span>name<span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div></li></ol> <h3 id="info-dev-h和info-dev-cpp"><a href="#info-dev-h和info-dev-cpp" class="header-anchor">#</a> info_dev.h和info_dev.cpp</h3> <p>用于获取和处理硬盘设备信息。以下是每个函数的功能总结：</p> <ol><li><p><strong><code>show_dev_info</code> 函数：</strong></p> <div class="language-CPP line-numbers-mode"><pre class="language-cpp"><code><span class="token keyword">void</span> <span class="token function">show_dev_info</span><span class="token punctuation">(</span>dev_info info<span class="token punctuation">)</span><span class="token punctuation">;</span>  <span class="token comment">//查看结构体信息</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div></li> <li><p><strong><code>less_enter</code> 函数：</strong></p> <div class="language-CPP line-numbers-mode"><pre class="language-cpp"><code><span class="token keyword">void</span> <span class="token function">less_enter</span><span class="token punctuation">(</span><span class="token keyword">char</span> <span class="token operator">*</span>buf<span class="token punctuation">)</span><span class="token punctuation">;</span>         <span class="token comment">//从字符尾部去除换行符号</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div></li> <li><p><strong><code>get_ctos</code> 函数：</strong></p> <div class="language-CPP line-numbers-mode"><pre class="language-cpp"><code>string <span class="token function">get_ctos</span><span class="token punctuation">(</span>dev_info info<span class="token punctuation">)</span><span class="token punctuation">;</span>     <span class="token comment">//格式转换 获取磁盘结构体信息</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div></li> <li><p><strong><code>get_info_fdisk</code> 函数：</strong></p> <div class="language-CPP line-numbers-mode"><pre class="language-cpp"><code>vector<span class="token operator">&lt;</span>dev_info<span class="token operator">&gt;</span> <span class="token function">get_info_fdisk</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>  <span class="token comment">//获取磁盘结构体信息</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><ul><li>通过执行 <code>fdisk -l</code> 命令获取系统中的硬盘设备信息。</li> <li><img src="https://cdn.jsdelivr.net/gh/xiaose-code/Pictures@main/img/1700202851599.webp" alt="1700202851599"></li> <li>返回一个包含硬盘设备信息结构体的向量。</li></ul></li> <li><p><strong><code>to_vec_send</code> 函数：</strong></p> <div class="language-CPP line-numbers-mode"><pre class="language-cpp"><code>vector<span class="token operator">&lt;</span>string<span class="token operator">&gt;</span> <span class="token function">to_vec_send</span><span class="token punctuation">(</span><span class="token keyword">const</span> vector<span class="token operator">&lt;</span>dev_info<span class="token operator">&gt;</span> <span class="token operator">&amp;</span>vec_dev<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 将硬盘设备信息结构体转换为网络传输格式的字符串向量。</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div></li></ol> <h3 id="scan-files-h和scan-files-cpp"><a href="#scan-files-h和scan-files-cpp" class="header-anchor">#</a> scan_files.h和scan_files.cpp</h3> <p>这段代码定义了一个名为 <code>scan_files</code> 的类，提供了一些功能来扫描目录、获取文件和目录信息，以及判断文件类型。以下是每个函数的功能总结：</p> <ol><li><p><strong><code>get_files</code> 函数：</strong></p> <div class="language-CPP line-numbers-mode"><pre class="language-cpp"><code><span class="token comment">// 递归的将路径下所有普通文件和目录放入容器</span>
<span class="token keyword">static</span> <span class="token keyword">bool</span> <span class="token function">get_files</span><span class="token punctuation">(</span><span class="token keyword">const</span> string <span class="token operator">&amp;</span>path<span class="token punctuation">,</span>vector<span class="token operator">&lt;</span>string<span class="token operator">&gt;</span> <span class="token operator">&amp;</span>vec_files<span class="token punctuation">,</span>vector<span class="token operator">&lt;</span>string<span class="token operator">&gt;</span> <span class="token operator">&amp;</span>vec_dir<span class="token punctuation">)</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><ul><li>参数1：扫描目录（绝对路径）。</li> <li>参数2：存储文件路径的容器。</li> <li>参数3：存储目录路径的容器。</li></ul></li> <li><p><strong><code>get_tree_dir</code> 函数：</strong></p> <div class="language-cpp line-numbers-mode"><pre class="language-cpp"><code><span class="token comment">// 对 get_tree 函数的简单调用，用于获取带层级的文件目录。</span>
<span class="token keyword">static</span> <span class="token keyword">bool</span> <span class="token function">get_tree_dir</span><span class="token punctuation">(</span><span class="token keyword">const</span> string <span class="token operator">&amp;</span>path_abs<span class="token punctuation">,</span>vector<span class="token operator">&lt;</span>tree<span class="token operator">&gt;</span> <span class="token operator">&amp;</span>vec_tree<span class="token punctuation">)</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><ul><li>参数1：扫描目录（绝对路径）。</li> <li>参数2：存储文件和目录结构信息的容器。</li></ul></li> <li><p><strong><code>get_tree</code> 函数：</strong></p> <div class="language-CPP line-numbers-mode"><pre class="language-cpp"><code><span class="token comment">// 递归获取带层级的文件目录，深度优先（获取当前层文件，然后进入子文件夹获取所有内容，再获取第二个子文件夹）</span>
<span class="token keyword">static</span> <span class="token keyword">bool</span> <span class="token function">get_tree</span><span class="token punctuation">(</span><span class="token keyword">const</span> string <span class="token operator">&amp;</span>abs<span class="token punctuation">,</span><span class="token keyword">const</span> string <span class="token operator">&amp;</span>rel<span class="token punctuation">,</span>vector<span class="token operator">&lt;</span>tree<span class="token operator">&gt;</span> <span class="token operator">&amp;</span>vec_tree<span class="token punctuation">,</span><span class="token keyword">int</span> deep<span class="token punctuation">)</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><ul><li>参数1：扫描目录的绝对路径。</li> <li>参数2：文件或目录名称。</li> <li>参数3：存储文件和目录结构信息的容器。</li> <li>参数4：递归深度。</li></ul></li> <li><p><strong><code>is_dir</code> 函数：</strong></p> <div class="language-CPP line-numbers-mode"><pre class="language-cpp"><code><span class="token comment">//判断目录</span>
<span class="token keyword">static</span> <span class="token keyword">bool</span> <span class="token function">is_dir</span><span class="token punctuation">(</span>string path<span class="token punctuation">)</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><ul><li>参数：待判断的路径。</li></ul></li> <li><p><strong><code>is_file</code> 函数：</strong></p> <div class="language-CPP line-numbers-mode"><pre class="language-cpp"><code><span class="token comment">//判断普通文件</span>
<span class="token keyword">static</span> <span class="token keyword">bool</span> <span class="token function">is_file</span><span class="token punctuation">(</span>string path<span class="token punctuation">)</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><ul><li>参数：待判断的路径。</li></ul></li></ol> <h3 id="web-connect-h和web-connect-cpp"><a href="#web-connect-h和web-connect-cpp" class="header-anchor">#</a> web_connect.h和web_connect.cpp</h3> <div class="language-CPP line-numbers-mode"><pre class="language-cpp"><code><span class="token keyword">void</span> <span class="token function">on_open</span><span class="token punctuation">(</span><span class="token keyword">const</span> sock_unix <span class="token operator">&amp;</span>sock<span class="token punctuation">)</span><span class="token punctuation">;</span>                        <span class="token comment">//连接成功</span>
<span class="token keyword">void</span> <span class="token function">on_message</span><span class="token punctuation">(</span><span class="token keyword">const</span> sock_unix <span class="token operator">&amp;</span>sock<span class="token punctuation">,</span> <span class="token keyword">const</span> string <span class="token operator">&amp;</span>msg<span class="token punctuation">)</span><span class="token punctuation">;</span>  <span class="token comment">//接收客户端</span>
<span class="token keyword">void</span> <span class="token function">on_close</span><span class="token punctuation">(</span><span class="token keyword">const</span> sock_unix <span class="token operator">&amp;</span>sock<span class="token punctuation">)</span><span class="token punctuation">;</span>                       <span class="token comment">//关闭连接</span>
<span class="token keyword">void</span> <span class="token function">send_message</span><span class="token punctuation">(</span><span class="token keyword">const</span> string <span class="token operator">&amp;</span>msg<span class="token punctuation">)</span><span class="token punctuation">;</span>                       <span class="token comment">//发送消息到客户端</span>
function<span class="token operator">&lt;</span><span class="token keyword">void</span><span class="token punctuation">(</span><span class="token keyword">const</span> string <span class="token operator">&amp;</span><span class="token punctuation">)</span><span class="token operator">&gt;</span> fn_message <span class="token operator">=</span> <span class="token keyword">nullptr</span><span class="token punctuation">;</span>        <span class="token comment">//向外发送消息--用于工作函数接收</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br></div></div><h3 id="work-main-h和work-main-cpp"><a href="#work-main-h和work-main-cpp" class="header-anchor">#</a> work_main.h和work_main.cpp</h3> <p>这段代码是 <code>work_main</code> 类的实现部分。以下是每个函数的主要功能概述：</p> <ol><li><p><strong>构造函数：</strong></p> <ul><li>初始化线程池对象 <code>_pool_th</code>，用于执行任务函数。</li> <li>注册不同类型任务函数到 <code>_map_task</code> 容器，使用宏 <code>ADD_MAP_TASK</code> 简化注册过程。</li></ul></li> <li><p><strong>cb_message(string sjson)：</strong></p> <div class="language-CPP line-numbers-mode"><pre class="language-cpp"><code><span class="token keyword">void</span> <span class="token function">cb_message</span><span class="token punctuation">(</span>string msg<span class="token punctuation">)</span><span class="token punctuation">;</span>                    <span class="token comment">//接收客户端消息</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><ul><li>通过解析传入的 JSON 字符串，提取出任务类型和任务内容。</li> <li>根据任务类型查找 <code>_map_task</code> 容器中注册的任务函数。</li> <li>将任务函数和任务内容添加到线程池中异步执行。</li></ul></li> <li><p><strong>send_msg_th(string sjson)：</strong></p> <div class="language-CPP line-numbers-mode"><pre class="language-cpp"><code>function<span class="token operator">&lt;</span><span class="token keyword">void</span><span class="token punctuation">(</span>string<span class="token punctuation">)</span><span class="token operator">&gt;</span> fn_send_msg <span class="token operator">=</span> <span class="token keyword">nullptr</span><span class="token punctuation">;</span>   <span class="token comment">//向外传递消息--用于发送信息到客户端</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><ul><li>通过互斥锁确保在多线程环境中安全地发送消息。</li> <li>调用注册的外部回调函数 <code>fn_send_msg</code> 发送消息。</li></ul></li> <li><p><strong>task_ask_dev_back(string sjson)：</strong></p> <div class="language-CPP line-numbers-mode"><pre class="language-cpp"><code><span class="token keyword">void</span> <span class="token function">task_ask_dev_back</span><span class="token punctuation">(</span>string sjson<span class="token punctuation">)</span><span class="token punctuation">;</span>   <span class="token comment">//磁盘设备信息反馈</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><ul><li>获取磁盘信息，包括硬盘设备编号、用户重命名、硬盘容量、序列号等。</li> <li>转换为网络传输格式，发送给客户端。</li></ul></li> <li><p><strong>task_ask_wipe_file(string sjson)：</strong></p> <div class="language-CPP line-numbers-mode"><pre class="language-cpp"><code><span class="token keyword">void</span> <span class="token function">task_ask_wipe_file</span><span class="token punctuation">(</span>string sjson<span class="token punctuation">)</span><span class="token punctuation">;</span>  <span class="token comment">//处理请求粉碎文件</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><ul><li>获取需要粉碎的文件数组和粉碎次数。</li> <li>根据文件类型进行粉碎，包括单个文件和整个目录。</li> <li>将粉碎结果（成功/失败的文件）和粉碎次数发送给客户端。</li></ul></li> <li><p><strong>task_ask_wipe_rule(string sjson)：</strong></p> <div class="language-CPP line-numbers-mode"><pre class="language-cpp"><code><span class="token keyword">void</span> <span class="token function">task_ask_wipe_rule</span><span class="token punctuation">(</span>string sjson<span class="token punctuation">)</span><span class="token punctuation">;</span>  <span class="token comment">//处理请求粉碎规则</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><ul><li>获取需要粉碎的文件数组和粉碎次数。</li> <li>将目录展开成文件数组，然后进行粉碎操作。</li> <li>将粉碎结果（成功/失败的文件）发送给客户端。</li></ul></li> <li><p><strong>task_ask_wipe_disk(string sjson)：</strong></p> <div class="language-CPP line-numbers-mode"><pre class="language-cpp"><code><span class="token keyword">void</span> <span class="token function">task_ask_wipe_disk</span><span class="token punctuation">(</span>string sjson<span class="token punctuation">)</span><span class="token punctuation">;</span>  <span class="token comment">//处理请求磁盘清理</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><ul><li>获取需要粉碎的磁盘数组、粉碎次数、是否为中断继续、中断时的当前粉碎次数和偏移量。</li> <li>根据是否中断继续，启动或继续多个线程粉碎磁盘。</li> <li>发送粉碎进度信息给客户端。</li></ul></li> <li><p><strong>task_ask_stop_disk(string sjson)：</strong></p> <div class="language-CPP line-numbers-mode"><pre class="language-cpp"><code><span class="token keyword">void</span> <span class="token function">task_ask_stop_disk</span><span class="token punctuation">(</span>string sjson<span class="token punctuation">)</span><span class="token punctuation">;</span>  <span class="token comment">//处理停止磁盘清理</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><ul><li>获取需要停止的磁盘名称，从 <code>_map_disk</code> 中找到对应的粉碎操作，并设置停止标志。</li></ul></li> <li><p><strong>task_ask_ukey_back(string sjson)：</strong></p> <div class="language-CPP line-numbers-mode"><pre class="language-cpp"><code><span class="token keyword">void</span> <span class="token function">task_ask_ukey_back</span><span class="token punctuation">(</span>string sjson<span class="token punctuation">)</span><span class="token punctuation">;</span>  <span class="token comment">//处理请求UKey权限</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><ul><li>获取 UKey 权限信息，并发送给客户端。</li></ul></li> <li><p><strong>task_ask_close_back(string sjson)：</strong></p> <div class="language-cpp line-numbers-mode"><pre class="language-cpp"><code><span class="token keyword">void</span> <span class="token function">task_ask_close_back</span><span class="token punctuation">(</span>string sjson<span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div></li></ol> <ul><li>处理请求关闭的任务函数，退出程序。</li></ul></div></div> <!----> <div class="page-edit"><!----> <!----> <!----></div> <div class="page-nav-wapper"><div class="page-nav-centre-wrap"><!----> <a href="/pages/08dfe9/" class="page-nav-centre page-nav-centre-next"><div class="tooltip">项目解读</div></a></div> <div class="page-nav"><p class="inner"><!----> <span class="next"><a href="/pages/08dfe9/">项目解读</a>→
      </span></p></div></div></div> <!----></main></div> <div class="footer"><!----> 
  Theme by
  <a href="https://github.com/xugaoyi/vuepress-theme-vdoing" target="_blank" title="本站主题">Vdoing</a> 
    | Copyright © 2023-2023
    <span>霜晨月</span></div> <div class="buttons"><div title="返回顶部" class="button blur go-to-top iconfont icon-fanhuidingbu" style="display:none;"></div> <div title="去评论" class="button blur go-to-comment iconfont icon-pinglun" style="display:none;"></div> <div title="主题模式" class="button blur theme-mode-but iconfont icon-zhuti"><ul class="select-box" style="display:none;"><li class="iconfont icon-zidong">
          跟随系统
        </li><li class="iconfont icon-rijianmoshi">
          浅色模式
        </li><li class="iconfont icon-yejianmoshi">
          深色模式
        </li><li class="iconfont icon-yuedu">
          阅读模式
        </li></ul></div></div> <!----> <!----> <!----></div><div class="global-ui"><canvas id="vuepress-canvas-cursor"></canvas></div></div>
    <script src="/assets/js/app.ef25b098.js" defer></script><script src="/assets/js/2.4615a819.js" defer></script><script src="/assets/js/84.4602494c.js" defer></script>
  </body>
</html>
